﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using chessLogic;

namespace chessTest
{
    [TestFixture]
    class testPosition
    {
        [Test]
        public void testSetPosition()
        {
            Position position = new Position('a', 5);
            Assert.AreEqual(position.Letter, 'a');
            Assert.AreEqual(position.Number, 5);
        }
        [Test]
        public void testEqualsPositions()
        {
            Position position = new Position('a', 5);
            Assert.True(position.Equals(new Position('a', 5)));
        }
        [Test]
        public void testGetColNumber()
        {
            Position position = new Position('a', 5);
            Assert.AreEqual(position.GetCollNum(), 0);
        }
        [Test]
        public void testPositionIsOnBoard()
        { 
            Position position = new Position('a', 5);
            Assert.True(position.IsOnBoard());
            position.setPosition('n', 10);
            Assert.False(position.IsOnBoard());
        }
        [Test]
        public void testPositionToString()
        {
            Position position = new Position('a', 5);
            Assert.AreEqual("a6", position.ToString());
            position.setPosition('b', 7);
            Assert.AreEqual("b8", position.ToString());
        }
        [Test]
        public void testStringToPosition()
        {
            Position position = new Position("a5");
            Assert.AreEqual(position.ToString(), "a5");
        }
        [Test]
        public void testContainCharInPosition()
        {
            Position position = new Position("e4");
            Assert.True(position.ContainChar('e'));
            Assert.True(position.ContainChar('4'));
        }
    }
}
